<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <button id="readName">读取name</button>
        <button id="setName">设置name</button>
        <p id="objName"></p>
        <script type="module">
            import { ref, effect,isRef } from "./main.js";

            const name = ref("张三");
			console.log(isRef(name));
			console.log(`output->name`,name)
            effect(() => {
                objName.innerHTML = name.value;
                console.log(`触发副作用函数-name1`, name.value);
            });
            effect(() => {
                console.log(`触发副作用函数-name2`, name.value);
            });

            readName.onclick = function readVal() {
                console.log(`output->name`, name.value);
            };
            setName.onclick = function readVal() {
                name.value = `张三${Math.random()}`;
            };
        </script>
    </body>
</html>
